package com.sky.controller.user;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.Page;
import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("UserCategoryController")
@RequestMapping("/user/category")
@Slf4j
@Api("用户端分类接口")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    /**
     * 分类的分页查询
     */
    @ApiOperation("分类的分页查询")
    @GetMapping("/list")
    public Result<List<Category>> list(){
        LambdaQueryWrapper<Category> lambdaQueryWrapper=new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(Category::getStatus,1);
        List<Category> list = categoryService.list(lambdaQueryWrapper);
        return Result.success(list);
    }

}
